package models

import "gorm.io/gorm"

// StudentInfo 学生表
type StudentInfo struct {
	gorm.Model
	WxOpenID       string `json:"wx_open_id" gorm:"wx_open_id"`             //微信open_id
	Name           string `json:"name" gorm:"name"`                         //姓名
	StudentID      string `json:"student_id" gorm:"student_id"`             //学号
	Phone          string `json:"phone" gorm:"phone"`                       //电话
	ClassId        string `json:"class_id" gorm:"class_id"`                 //班级
	TeacherId      string `json:"teacher_id" gorm:"teacher_id"`             //老师
	LeaveInfoCount string `json:"leave_info_count" gorm:"leave_info_count"` //请假次数
	LeaveStatus    bool   `json:"leave_status" gorm:"leave_status"`         // 请假状态 0 false 1 true
}

func (StudentInfo) TableName() string {
	return "student_info"
}

type ClassInfo struct {
	gorm.Model
	Grade          int    `json:"grade" gorm:"grade"`                       //年级
	Name           string `json:"name" gorm:"name"`                         //名称
	PeopleCount    string `json:"people_count" gorm:"people_count"`         //总人数
	NowPeopleCount string `json:"now_people_count" gorm:"now_people_count"` //现在人数
	LeaveCount     string `json:"leave_count" gorm:"leave_count"`           //请假次数
	College        string `json:"college" gorm:"college"`                   //学院
}

func (ClassInfo) TableName() string {
	return "class_info"
}

// TeacherInfo 教师表
type TeacherInfo struct {
	gorm.Model
	Username  string `json:"username" gorm:"username"`     //用户名
	Password  string `json:"password" gorm:"password"`     //密码
	WxOpenID  string `json:"wx_open_id" gorm:"wx_open_id"` //微信open_id
	Name      string `json:"name" gorm:"name"`             //姓名
	ClassList string `json:"class_list" gorm:"class_list"` //班级
	Grade     int    `json:"grade" gorm:"grade"`           //年级
}

func (TeacherInfo) TableName() string {
	return "teacher_info"
}

// OperationInfo 操作员
type OperationInfo struct {
	gorm.Model
	CreateId    string `json:"create_id" gorm:"create_id"`
	CreateName  string `json:"create_name" gorm:"create_name"`
	Username    string `json:"username" gorm:"username"`
	Password    string `json:"password" gorm:"password"`
	StudentId   string `json:"student_id" gorm:"student_id"`
	StudentName string `json:"student_name" gorm:"student_name"`
}

func (OperationInfo) TableName() string {
	return "operator_info"
}

// LeaveInfo 请假记录表
type LeaveInfo struct {
	gorm.Model
	RequestID          string `json:"request_id" gorm:"request_id"`                     //请假人的ID
	RequestName        string `json:"request_name" gorm:"request_name"`                 //请假人的名字
	RequestCLassID     string `json:"request_class_id" gorm:"request_class_id"`         //班级
	RequestCLassName   string `json:"request_class_name" gorm:"request_class_name"`     //班级名称
	BeginTime          string `json:"start_time" gorm:"start_time"`                     //预计开始时间
	EndTime            string `json:"end_time" gorm:"end_time"`                         //预计结束时间
	Msg                string `json:"msg" gorm:"msg"`                                   //描述
	TeacherId          string `json:"teacher_id" gorm:"teacher_id"`                     //老师Id
	TeacherName        string `json:"teacher_name" gorm:"teacher_name"`                 //老师名称
	TeacherConfirm     bool   `json:"teacher_confirm" gorm:"teacher_confirm"`           //老师是确认
	TeacherConfirmTime string `json:"teacher_confirm_time" gorm:"teacher_confirm_time"` //老师确认时间
	ReturnConfirm      bool   `json:"return_confirm" gorm:"return_confirm"`             //返回确认
	ReturnConfirmTime  string `json:"return_confirm_time" gorm:"return_confirm_time"`   //返回确认时间
	ReturnConfirmID    string `json:"return_confirm_id" gorm:"return_confirm_id"`       //返回确认ID
	ReturnConfirmName  string `json:"return_confirm_name" gorm:"return_confirm_name"`   //返回确认
	Action             string `json:"action" gorm:"action"`                             //状态
}

func (LeaveInfo) TableName() string {
	return "leave_info"
}
